@extends('layouts.empty')

@section('css')
    <style>
        .font1{
            font-size: 8px;
            display: inline;;
        }
        .font2{
            font-size: 8px;
        }
        .flex-container{
            display: -webkit-flex; /* Safari */
            display: flex;
            flex-direction:column;
            justify-content:space-between;
        }
    </style>
@endsection

@section('content')
    <section class="content-header">
        <h1 class="text-center">
            订单详情
        </h1>
    </section>
    <div class="content">
        <div  class="flex-container">

            <div class="font1">
                编号: {{ $order->sn }}
            </div>
            @if($order->address)
                <div class="font1">
                    收货人:{{$order->address->name}}
                </div>
                <div class="font1">
                    电话:{{$order->address->phone}}
                </div>
                <div class="font1">
                    地址:{{$order->address->address}}
                </div>
        </div>
        <div class="box box-primary">
            <div class="box-body">

                <div class="row table-responsive" style="padding-left: 10px">

                    @else
                    @endif
                    <table class="table table-bordered">
                    <tr>
                        <th>#</th>
                        <th>商品名称</th>
                        <th>规格</th>
                        <th>数量</th>
                        <th>单价</th>
                        <th>小记</th>
                    </tr>
                        @foreach($order->goods as $k=>$v)
                            <tr>
                                <td>{{ $k+1 }}</td>
                                    @if($v->status==12)
                                    <td>
                                        <s>{{ $v->goods->name }} {{ $v->goods->title }}</s>
                                    </td>
                                    <td>
                                        <s>{!! $v->attribute_id?$v->attribute->name:'' !!}
                                        </s>
                                    </td>
                                    <td><s>{{ $v->number }}</s></td>
                                    <td><s>{{ $v->price }}</s></td>
                                    <td><s>{{ $v->number*$v->price }}</s></td>
                                    @else
                                    <td>{{ $v->goods->name }} {{ $v->goods->title }}</td>
                                    <td>{!! $v->attribute_id?$v->attribute->name:'' !!}</td>
                                    <td>{{ $v->number }}</td>
                                    <td>{{ $v->price }}</td>
                                    <td>{{ $v->number*$v->price }}</td>
                                    @endif
                            </tr>
                        @endforeach
                        <tr>
                            <td colspan="3">合计</td>
                            <td>{{ $order->goods_number }}</td>
                            <td></td>
                            <td>{{ $order->price }}</td>
                        </tr>
                        <tr>
                            <td colspan="3">优惠券</td>
                            @if($order->bonus)
                                <td>{{ $order->bonus->name }}</td>
                                <td>满{{ $order->bonus->min_amount }}</td>
                                <td>减{{ $order->bonus->money }}</td>
                                <?php $money = $order->bonus->money;?>
                            @else
                                <td></td>
                                <td></td>
                                <td></td>
                                <?php $money = 0;?>
                            @endif
                        </tr>
                        <tr>
                            <td colspan="3">实际</td>
                            <td>{{ $order->calculate_goods_number }}</td>
                            <td></td>
                            <td>{{ ($order->calculate_price-$money)>0?($order->calculate_price-$money):0 }}</td>
                        </tr>
                    </table>
                    <div style="margin-right: 50px">
                        <div class="flex-container">

                            <div class="font1" style="margin-left: 6px">
                                配送时间:{{ $order->shipping_status==1?$order->shipping_at:'自提' }}
                            </div>
                            {{--<div class="font1">--}}
                                {{--使用积分:{{ $order->use_integral }}--}}
                            {{--</div>--}}
                            {{--<div class="font1">--}}
                                {{--实际金额:{{ $order->calculate_money }}--}}
                            {{--</div>--}}

                        </div>

                        <div>
                            <div class="font2" style="margin-left: 6px;">
                                买家留言:{{ $order->remark }}
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection


@section('scripts')
    <script>
        function btnPrintClick(){
            window.print();
        }
    </script>
@endsection